

const SERVER_NAME_AUTH = "/vaie-cloud-cms"
const URL_PREFIX_SYSTEM = SERVER_NAME_AUTH+"/v1/cms/menu"

const businessIssue142Db = [
    {id: '5', name: '用户 1', address: '上海市普陀区金沙江路 1518 弄'},
    {id: '2', name: '用户 2', address: '上海市普陀区金沙江路 1517 弄'},
    {id: '3', name: '用户 3', address: '上海市普陀区金沙江路 1519 弄'},
    {id: '4', name: '用户 4', address: '上海市普陀区金沙江路 1516 弄'}
]
export default ({request,tools,mock}) =>({

    /**
     * 查询菜单
     * @param params
     * @returns {*}
     * @constructor
     */
    SYSTEM_MENU_SEARCHING( params = {}) {
        const url = URL_PREFIX_SYSTEM

        // for (let i = 0; i <1000 ; i++) {
        //     // businessIssue142Db.push({id: i, name: '用户'+i, address: '上海市普陀区金沙江路 1518 弄'})
        // }
        // 模拟数据
        mock
            .onAny(url)
            .reply(...tools.responseSuccess(
                {list: businessIssue142Db,total:businessIssue142Db.length+500}
            ))
        // 接口请求
        return request({
            url: url,
            method: 'get',
            params
        })
    },

    /**
     * 查询菜单
     * @param params
     * @returns {*}
     * @constructor
     */
    SYSTEM_MENU_CREATE( data = {}) {
        const url = URL_PREFIX_SYSTEM

        // 接口请求
        return request({
            url: url,
            method: 'post',
            data
        })
    },

    /**
     * 加载可选菜单
     * @param params
     * @returns {*}
     * @constructor
     */
    SYSTEM_MENU_LOAD_CHOOSABLE_MENU( params = {}) {
        const url = URL_PREFIX_SYSTEM+'/loadChoosableMenu'

        // 接口请求
        return request({
            url: url,
            method: 'get',
            params
        })
    }


})